#FROM node:lts-alpine
#RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
#COPY package.json .
#RUN cnpm install
#COPY . .
#RUN npm run build

FROM node:lts-alpine
COPY package.json .
RUN npm install

FROM node:lts-alpine
WORKDIR /app
COPY --from=0 /node_modules /app/node_modules
COPY . .
RUN npm run build

FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=1 /app/dist /usr/share/nginx/html

RUN apk add tzdata
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

CMD ["nginx", "-g", "daemon off;"]
